Ext.define('Demo.view.purchase.cgdddPanel',{
	extend: 'Ext.panel.Panel',
	alias: 'widget.cgdddPanel',
	items: [
	        {
	        	xtype: 'topBar',
	        	id: "cgxjdTop",
	        	store: Ext.create("Demo.store.purchase.purchaseOrderStore",{})
	        },
	        {
	        	xtype:"form",
	        	layout:'column',
	        	items:[
	        	       {
		        	    	 xtype: 'testText1',
					    	 name: 'supplierNo',
							 fieldLabel: '供应商',
							 emptyText : '请输入供应商'
	        	       },
					   {		
							 style: 'margin:10px 0px 0px 60px;',
					    	 xtype: 'datefield',
							 name: 'billDate',
							 bodyPadding: 5,
							 fieldLabel: '单据日期',
							 width: 250,
							 labelWidth: 80,
							 format:"Y-m-d",
							 value: new Date()
					   },
					   {
					    	 xtype: 'testText1',
							 name: 'addressNo',
							 fieldLabel: '供应商地址',
							 width: 180,
					   },
					   {	
						   	 style: 'margin-top:10px',
						   	 xtype: 'testText1',
							 name: '',
							 width: 150,
					   },{ style: 'margin:10px 0px 0px 60px;',
						   	 xtype: 'datefield',
							 name: 'validDate',
							 bodyPadding: 5,
							 fieldLabel: '有效日期',
							 width: 250,
							 labelWidth: 80,
							 format:"Y-m-d",
							 value: new Date()
					   },
					   {
						   	 xtype: 'testText1',
							 name: 'billNo',
							 fieldLabel: '单据号码',
							 format:"Y-m-d",
							 width: 250,
							 store:function(){
								 
							 }
					   },
					   
					   {
						     xtype: 'testText1',
							 name: 'moneyType',
							 fieldLabel: '币别',
							 width: 250,
							 value: '人民币'
					   },
					   {
						     style: 'margin:10px 0px 0px 60px;',
						     xtype: 'combo',
					    	 name: 'PriceOfTax',
							 bodyPadding: 5,
							 fieldLabel: '单价是否含税',
							 width: 250,
							 labelWidth: 80,
							 store: Ext.create('Ext.data.Store', {
									fields: ['value', 'text'],
			    					data : [
			    					        {"value":"0", "text":"未税"},
			    					        {"value":"1", "text":"含税"}
			    					        ]
								}),
					   },
					   {
						     xtype: 'testText1',
							 name: 'exchRate',
							 fieldLabel: '汇率',
							 width: 250,
							 value: '1.0000'
					   },
					   {
							xtype: 'tabpanel',
						    width: 950,
							height: 230,
							style: 'margin:10px 0px 0px 60px',
							items: [
							        {
							        	title:'内容',
							        	autoScroll:true,
							        	items:[
											   { 
												   xtype: 'panel',
												   items:[
												          {
												        	  xtype: 'grid',
												        	  store: ['purchase.purchaseOrderStore'],
												        	  
												        	  height: 160,
												        	  columns: [
																{header : '（栏号）',xtype : 'rownumberer',dataIndex : 'lineId',width : 50,sortable : false},
																{header : '物料编号',dataIndex : 'materialNo',width : 100,
																	editor : {
																		xtype : 'textfield',
																		listeners : {
																			focus : function(grid, e, eOpts) {
														//	 					windows2.show();
																			}
														
																		}
																	}}, 
																{
																header : '物料名称',
																dataIndex : 'dizhi',
																width : 120
																},
																{header : '规格型号',dataIndex : 'bianma'}, 
																{header : '单位名称',dataIndex : 'lianxi'},
																{header : '数量',dataIndex : 'pioNum',
																	editor : {
																		xtype : 'textfield',
																		listeners : {
																			focus : function(grid, e, eOpts) {
														//	 					windows2.show();
																			}
														
																		}
																	}},
																{header : '折扣前单价',dataIndex : 'pioZkqPrice'},
																{header : '折数(%)',dataIndex : 'lianxi'}, 
																{header : '单价',dataIndex : 'pioPrice',
																	editor : {
																		xtype : 'textfield',
																		listeners : {
																			focus : function(grid, e, eOpts) {
														//	 					windows2.show();
																			}
														
																		}
																	}},
																{header : '金额',dataIndex : 'pioZmoney',
																	editor : {
																		xtype : 'textfield',
																		listeners : {
																			focus : function(grid, e, eOpts) {
														//	 					windows2.show();
																			}
														
																		}
																	}}, 
																{header : '税率',dataIndex : 'lianxi'}, 
																{header : '税额',dataIndex : 'lianxi'},
																{header : '含税金额',dataIndex : 'pioHsMoney'}, 
																{header : '赠品',dataIndex : 'lianxi'},
																{header : '分录备注',dataIndex : 'remark',
																	editor : {
																		xtype : 'textfield',
																		listeners : {
																			focus : function(grid, e, eOpts) {
														//	 					windows2.show();
																			}
														
																		}
																	}},
																{header : '来源单别',dataIndex : 'SourceType'}, 
																{header : '来源单号',dataIndex : 'sourceOrder'}
															],
												        	  plugins: [  
												        	            Ext.create('Ext.grid.plugin.CellEditing',{  
												        					clicksToEdit:1 //设置单击单元格编辑  
												        				})  
												        			   ],  
												        	  listeners:{
												        				 //双击行事件  
												        		  itemdblclick:function(dataview, record, item, index, e){
												        			  alert('itemdblclick');
												        			  var data  = {  
												        			  };
												        			  //添加一行表格
												        			  this.getStore().add(data);
												        		}
												        	  }
												          	}
												          ],
												   width:2000,       
												   bbar:[
												         {xtype:"label",text:'总计:',width:90},
												         {xtype:"textfield",disabled:true,width:90,margin:'0 180',value:'0.00'},
												         {xtype:"textfield",disabled:true,width:90,margin:'0',value:'0.00'},
												         {xtype:"textfield",disabled:true,width:90,margin:'0 40 0 30',value:'0.00'},
												         {xtype:"textfield",disabled:true,width:90,margin:'0 0 0 0',value:'0.00'}
												        ]
											    }
							        	      ]
							        },
							        {title:'账款'},
							        {title:'备注'}
							       ],
					   }
					   ,{
						   xtyle: 'form',
						   store: ['purchase.purchaseOrderStore'],
						   layout: 'column',
						   baseCls: 'x-plain',
						   items:[{
								 xtype: 'testText1',
								 name: '',
								 fieldLabel: '送货地址',
							  },
						          {
									xtype: 'testText1',
									name: 'bizMan',
									fieldLabel: '采购人员',
						          },
								  {
									 xtype: 'testText1',
									 name: '',
									 fieldLabel: '所属部门',
								  },{
										xtype: 'testText1',
										name: 'maker',
										fieldLabel: '制单人员',
								},{
									 xtype: 'testText1',
									 name: 'permitter',
									 fieldLabel: '复核人员',
								  },
								  
						         ]
					   	},{
					   		style: 'margin:20px 0px 0px 60px',
					   		xtype: 'splitbutton',
					   		text: '查询',
					   		width: 90,
					   		menu: {
				   		 	       xtype: 'menu',
				   		 	       items: [
					   		 	       {
					   			    	   text:'历史交易查询',handler:function(){
					   			    	   afronction();
					   				
					   			    	   }
					   			       }
					   		 	   ] 
					   			  }
					   	},
					   	{
					   		style: 'margin:20px 0px 0px 20px',
					   		xtype:"splitbutton",
					   		text:'转单',
					   		width:90,
					   		menu:{
				   		 	       xtype: 'menu',
				   		 	       items: [
					   		 	       {
					   			    	   text:'销售订单转入',handler:function(){
					   			    	   afronction();
					   				
					   			    	   }
					   			       },{
					   			    	   text:'采购请购单转入',handler:function(){
						   			    	   afronction();
						   				
						   			    	   }
						   			       }
					   		 	   ] 
					   			  }
					   	},
					   	{
					   		style: 'margin:20px 0px 0px 20px',
					   		xtype:"splitbutton",
					   		text:'功能',
					   		width:90,
					   		menu:{
				   		 	       xtype: 'menu',
				   		 	       items: [
					   		 	       {
					   			    	   text:'批量变更价格',handler:function(){
					   			    	   afronction();
					   				
					   			    	   }
					   			       }
					   		 	   ] 
					   			  }
					   	}
					  ]
	        }
	      ]
});